<%-- 
    Document   : index
    Created on : 19 nov. 2010, 16:18:32
    Author     : boomar
--%>

<%@page import="java.util.Iterator"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Site de vente en ligne</title>
    </head>
    <body>
        <center>
            <h1>Site de vente en ligne : </h1>
            <div id="pannier"></div>
            <form name="commande" method="POST" action="">
                <%

                            onLineCmd.ListeArticles articles = (onLineCmd.ListeArticles) request.getAttribute("articles");

                            out.println(articles.toString());
                            
                            java.util.Iterator<onLineCmd.Article> it = articles.getListeArticles().iterator();
                            StringBuilder str = new StringBuilder();
                            str.append("<table border = \"1\">\n");
                            while (it.hasNext()) {
                                onLineCmd.Article article = it.next();
                                str.append("\n\t<tr>");
                                str.append("<td>" + article.getNom() + "</td>");
                                str.append("<td>" + article.getPrix() + "</td>");
                                str.append("<td>" + article.getDecription() + "</td>");
                                str.append("<td> <input type=\"button\" value = \"commander\" onclick=\"addToCart(" + article.getId() + ")\" >" + article.getNom() + "</td>");
                                str.append("\n</tr>");
                            }
                            str.append("</table>");

                            out.println(str.toString());
                %>
            </form>
        </center>
    </body>
</html>
